package com.snailxr.base.task.service;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.snailxr.base.task.dao.impl.DataTransferDaoImpl;

@Service("dataTransferService")
public class DataTransferService {
	public final Logger log = Logger.getLogger(this.getClass());
	@Resource(name="dataTransferDaoImpl")
	DataTransferDaoImpl dataTransferDaoImpl;
	
	/**
	 * 删除全部数据
	 */
	public void deleteAll(String collectionName){
		dataTransferDaoImpl.delete(collectionName);
	}
	
	/**
	 * 插入数据
	 */
	public void insertJson(JSONObject json,String collectionName){
		dataTransferDaoImpl.insert(json, collectionName);
	}
	
	/**
	 * 查询全部数据
	 */
	public JSONArray findAll(String collectionName){
		JSONArray jsonArry = dataTransferDaoImpl.selectAll(collectionName);
		return jsonArry;
	}
}
